#ifndef POINT_H
#define POINT_H

#include <math.h>
#include "Vector.h"

class Point {
public:
	double x;
	double y;
	double z;

public:
	static const Point ORIGIN;

public:
	Point(const double X, const double Y, const double Z);
	Point(const Point &cpy);

	void set(const Point &cpy);
	void set(const double &X, const double &Y, const double &Z);

	Point& rotateAroundPivotOnX(const double &radAngle, const Point &pivot);
	Point& rotateAroundPivotOnY(const double &radAngle, const Point &pivot);
	Point& rotateAroundPivotOnZ(const double &radAngle, const Point &pivot);

	double distanceTo(const Point &target) const;
	double distanceToOrigin() const;
	double squareDistanceTo(const Point &target) const;
	double squareDistanceToOrigin() const;

	Point& add(const Vector &op2);
	Point& add(const double &x, const double &y, const double &z);
	Point& subtract(const Vector &op2);
	Point& subtract(const double &x, const double &y, const double &z);
	Vector subtract(const Point &op2) const;
	Point& interpolate(const Point &op2, const double &alpha);

	bool isOrigin() const;
	bool isClosestToOrigin(const Point &r) const;
	bool isFarthestFromOrigin(const Point &r) const;
	bool isClosestToPoint(const Point &point, const Point &r) const;
	bool isFarthestFromPoint(const Point &point, const Point &r) const;
};

#endif // POINT_H
